using System;
using System.Linq;
using System.Data.Objects;
using System.Collections.Generic;
using Acme.Northwind.EFDAL.Entity;
using System.Linq.Expressions;

namespace Acme.Northwind.EFDAL
{
	#region NorthwindEntitiesExtensions

	/// <summary>
	/// Extension methods for this library
	/// </summary>
	[System.CodeDom.Compiler.GeneratedCode("nHydrateModelGenerator", "5.0.1.100")]
	public static partial class NorthwindEntitiesExtensions
	{
		#region Include Extension Methods

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Category> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Category> item, Expression<Func<Acme.Northwind.EFDAL.CategoryInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Customer> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Customer> item, Expression<Func<Acme.Northwind.EFDAL.CustomerInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> item, Expression<Func<Acme.Northwind.EFDAL.CustomerCustomerDemoInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.CustomerDemographic> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.CustomerDemographic> item, Expression<Func<Acme.Northwind.EFDAL.CustomerDemographicInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Employee> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Employee> item, Expression<Func<Acme.Northwind.EFDAL.EmployeeInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> item, Expression<Func<Acme.Northwind.EFDAL.EmployeeTerritorieInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Order> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Order> item, Expression<Func<Acme.Northwind.EFDAL.OrderInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.OrderDetail> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.OrderDetail> item, Expression<Func<Acme.Northwind.EFDAL.OrderDetailInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Product> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Product> item, Expression<Func<Acme.Northwind.EFDAL.ProductInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Region> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Region> item, Expression<Func<Acme.Northwind.EFDAL.RegionInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Shipper> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Shipper> item, Expression<Func<Acme.Northwind.EFDAL.ShipperInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Supplier> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Supplier> item, Expression<Func<Acme.Northwind.EFDAL.SupplierInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		/// <summary>
		/// Specifies the related objects to include in the query results.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="query">The LINQ expresssion that maps an include path</param>
		public static ObjectQuery<Acme.Northwind.EFDAL.Entity.Territory> Include(this ObjectQuery<Acme.Northwind.EFDAL.Entity.Territory> item, Expression<Func<Acme.Northwind.EFDAL.TerritoryInclude, nHydrate.EFCore.DataAccess.IContextInclude>> query)
		{
			var strings = new List<string>(query.Body.ToString().Split('.'));
			strings.RemoveAt(0);
			var compoundString = string.Empty;
			foreach (var s in strings)
			{
				if (!string.IsNullOrEmpty(compoundString)) compoundString += ".";
				compoundString += s;
				item = item.Include(compoundString);
			}
			return item;
		}

		#endregion

		#region GetFieldType Extension Method

		/// <summary>
		/// Get the system type of a field of one of the contained context objects
		/// </summary>
		public static System.Type GetFieldType(this Acme.Northwind.EFDAL.NorthwindEntities context, Enum field)
		{
			if (field is Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants)
				return Category.GetFieldType((Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants)
				return Customer.GetFieldType((Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants)
				return CustomerCustomerDemo.GetFieldType((Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants)
				return CustomerDemographic.GetFieldType((Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants)
				return Employee.GetFieldType((Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants)
				return EmployeeTerritorie.GetFieldType((Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants)
				return Order.GetFieldType((Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants)
				return OrderDetail.GetFieldType((Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants)
				return Product.GetFieldType((Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants)
				return Region.GetFieldType((Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants)
				return Shipper.GetFieldType((Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants)
				return Supplier.GetFieldType((Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants)field);
			if (field is Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants)
				return Territory.GetFieldType((Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants)field);
			throw new Exception("Unknown field type!");
		}

		#endregion

		#region Metadata Extension Methods

		/// <summary>
		/// Creates and returns a metadata object for an entity type
		/// </summary>
		/// <param name="entity">The source class</param>
		/// <returns>A metadata object for the entity types in this assembly</returns>
		public static nHydrate.EFCore.DataAccess.IMetadata GetMetaData(this nHydrate.EFCore.DataAccess.INHEntityObject entity)
		{
			var a = entity.GetType().GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.MetadataTypeAttribute), true).FirstOrDefault();
			if (a == null) return null;
			var t = ((System.ComponentModel.DataAnnotations.MetadataTypeAttribute)a).MetadataClassType;
			if (t == null) return null;
			return Activator.CreateInstance(t) as nHydrate.EFCore.DataAccess.IMetadata;
		}

		#endregion

		#region GetEntityType

		/// <summary>
		/// Determines the entity from one of its fields
		/// </summary>
		public static System.Type GetEntityType(EntityMappingConstants entityType)
		{
			switch (entityType)
			{
				case EntityMappingConstants.Category: return typeof(Acme.Northwind.EFDAL.Entity.Category);
				case EntityMappingConstants.Customer: return typeof(Acme.Northwind.EFDAL.Entity.Customer);
				case EntityMappingConstants.CustomerCustomerDemo: return typeof(Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo);
				case EntityMappingConstants.CustomerDemographic: return typeof(Acme.Northwind.EFDAL.Entity.CustomerDemographic);
				case EntityMappingConstants.Employee: return typeof(Acme.Northwind.EFDAL.Entity.Employee);
				case EntityMappingConstants.EmployeeTerritorie: return typeof(Acme.Northwind.EFDAL.Entity.EmployeeTerritorie);
				case EntityMappingConstants.Order: return typeof(Acme.Northwind.EFDAL.Entity.Order);
				case EntityMappingConstants.OrderDetail: return typeof(Acme.Northwind.EFDAL.Entity.OrderDetail);
				case EntityMappingConstants.Product: return typeof(Acme.Northwind.EFDAL.Entity.Product);
				case EntityMappingConstants.Region: return typeof(Acme.Northwind.EFDAL.Entity.Region);
				case EntityMappingConstants.Shipper: return typeof(Acme.Northwind.EFDAL.Entity.Shipper);
				case EntityMappingConstants.Supplier: return typeof(Acme.Northwind.EFDAL.Entity.Supplier);
				case EntityMappingConstants.Territory: return typeof(Acme.Northwind.EFDAL.Entity.Territory);
			}
			throw new Exception("Unknown entity type!");
		}

		#endregion

		#region GetValue Methods

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Category item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Category, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Category item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Category, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Category item, Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Category item, Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Customer item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Customer, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Customer item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Customer, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Customer item, Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Customer item, Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo item, Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo item, Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerDemographic item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerDemographic item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerDemographic item, Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.CustomerDemographic item, Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Employee item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Employee, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Employee item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Employee, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Employee item, Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Employee item, Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.EmployeeTerritorie item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.EmployeeTerritorie item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.EmployeeTerritorie item, Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.EmployeeTerritorie item, Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Order item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Order, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Order item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Order, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Order item, Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Order item, Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.OrderDetail item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.OrderDetail, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.OrderDetail item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.OrderDetail, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.OrderDetail item, Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.OrderDetail item, Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Product item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Product, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Product item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Product, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Product item, Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Product item, Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Region item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Region, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Region item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Region, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Region item, Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Region item, Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Shipper item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Shipper, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Shipper item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Shipper, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Shipper item, Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Shipper item, Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Supplier item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Supplier, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Supplier item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Supplier, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Supplier item, Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Supplier item, Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Territory item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Territory, T>> selector)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="selector">The field to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Territory item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Territory, T>> selector, T defaultValue)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants), tn, true);
			return item.GetValue<T>(te, defaultValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Territory item, Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants field)
		{
			return item.GetValue<T>(field, default(T));
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		/// <typeparam name="T">The type of value to retrieve</typeparam>
		/// <param name="item">The item from which to pull the value.</param>
		/// <param name="field">The field value to retrieve</param>
		/// <param name="defaultValue">The default value to return if the specified value is NULL</param>
		/// <returns></returns>
		public static T GetValue<T>(this Acme.Northwind.EFDAL.Entity.Territory item, Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants field, T defaultValue)
		{
			var valid = false;
			if (typeof(T) == typeof(bool)) valid = true;
			else if (typeof(T) == typeof(byte)) valid = true;
			else if (typeof(T) == typeof(char)) valid = true;
			else if (typeof(T) == typeof(DateTime)) valid = true;
			else if (typeof(T) == typeof(decimal)) valid = true;
			else if (typeof(T) == typeof(double)) valid = true;
			else if (typeof(T) == typeof(int)) valid = true;
			else if (typeof(T) == typeof(long)) valid = true;
			else if (typeof(T) == typeof(Single)) valid = true;
			else if (typeof(T) == typeof(string)) valid = true;
			if (!valid)
				throw new Exception("Cannot convert object to type '" + typeof(T).ToString() + "'!");

			object o = item.GetValue(field, defaultValue);
			if (o == null) return defaultValue;

			if (o is T)
			{
				return (T)o;
			}
			else if (typeof(T) == typeof(bool))
			{
				return (T)(object)Convert.ToBoolean(o);
			}
			else if (typeof(T) == typeof(byte))
			{
				return (T)(object)Convert.ToByte(o);
			}
			else if (typeof(T) == typeof(char))
			{
				return (T)(object)Convert.ToChar(o);
			}
			else if (typeof(T) == typeof(DateTime))
			{
				return (T)(object)Convert.ToDateTime(o);
			}
			else if (typeof(T) == typeof(decimal))
			{
				return (T)(object)Convert.ToDecimal(o);
			}
			else if (typeof(T) == typeof(double))
			{
				return (T)(object)Convert.ToDouble(o);
			}
			else if (typeof(T) == typeof(int))
			{
				return (T)(object)Convert.ToInt32(o);
			}
			else if (typeof(T) == typeof(long))
			{
				return (T)(object)Convert.ToInt64(o);
			}
			else if (typeof(T) == typeof(Single))
			{
				return (T)(object)Convert.ToSingle(o);
			}
			else if (typeof(T) == typeof(string))
			{
				return (T)(object)Convert.ToString(o);
			}
			throw new Exception("Cannot convert object!");
		}

		#endregion

		#region SetValue
		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Category item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Category, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Category item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Category, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.CustomerDemographic item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.CustomerDemographic item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Customer item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Customer, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Customer item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Customer, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Employee item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Employee, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Employee item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Employee, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.EmployeeTerritorie item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.EmployeeTerritorie item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.OrderDetail item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.OrderDetail, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.OrderDetail item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.OrderDetail, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Order item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Order, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Order item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Order, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Product item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Product, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Product item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Product, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Region item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Region, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Region item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Region, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Shipper item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Shipper, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Shipper item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Shipper, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Supplier item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Supplier, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Supplier item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Supplier, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Territory item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Territory, TResult>> selector, TResult newValue)
		{
			SetValue(item, selector, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="item">The entity to set</param>
		/// <param name="selector">The field on the entity to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public static void SetValue<TResult>(this Acme.Northwind.EFDAL.Entity.Territory item, System.Linq.Expressions.Expression<System.Func<Acme.Northwind.EFDAL.Entity.Territory, TResult>> selector, TResult newValue, bool fixLength)
		{
			var b = selector.Body.ToString();
			var arr = b.Split('.');
			if (arr.Length != 2) throw new System.Exception("Invalid selector");
			var tn = arr.Last();
			var te = (Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants)Enum.Parse(typeof(Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants), tn, true);
			item.SetValue(te, newValue);
		}

		#endregion

		#region GetPagedResults
		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Category> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Category> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Category> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Category> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Category> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Category> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Category> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Category> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Category> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Category> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Category, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Category.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Category.FieldNameConstants.CategoryID:
						if (ob.Ascending) q = q.OrderBy(x => x.CategoryID);
						else q = q.OrderByDescending(x => x.CategoryID);
						break;
					case Entity.Category.FieldNameConstants.CategoryName:
						if (ob.Ascending) q = q.OrderBy(x => x.CategoryName);
						else q = q.OrderByDescending(x => x.CategoryName);
						break;
					case Entity.Category.FieldNameConstants.Description:
						if (ob.Ascending) q = q.OrderBy(x => x.Description);
						else q = q.OrderByDescending(x => x.Description);
						break;
					case Entity.Category.FieldNameConstants.Picture:
						if (ob.Ascending) q = q.OrderBy(x => x.Picture);
						else q = q.OrderByDescending(x => x.Picture);
						break;
					case Entity.Category.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Category.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Category.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Category.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.CustomerCustomerDemo.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.CustomerCustomerDemo.FieldNameConstants.CustomerID:
						if (ob.Ascending) q = q.OrderBy(x => x.CustomerID);
						else q = q.OrderByDescending(x => x.CustomerID);
						break;
					case Entity.CustomerCustomerDemo.FieldNameConstants.CustomerTypeID:
						if (ob.Ascending) q = q.OrderBy(x => x.CustomerTypeID);
						else q = q.OrderByDescending(x => x.CustomerTypeID);
						break;
					case Entity.CustomerCustomerDemo.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.CustomerCustomerDemo.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.CustomerCustomerDemo.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.CustomerCustomerDemo.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerDemographic> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerDemographic> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerDemographic> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerDemographic> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerDemographic> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerDemographic> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerDemographic> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerDemographic> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.CustomerDemographic> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.CustomerDemographic> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.CustomerDemographic, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.CustomerDemographic.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.CustomerDemographic.FieldNameConstants.CustomerDesc:
						if (ob.Ascending) q = q.OrderBy(x => x.CustomerDesc);
						else q = q.OrderByDescending(x => x.CustomerDesc);
						break;
					case Entity.CustomerDemographic.FieldNameConstants.CustomerTypeID:
						if (ob.Ascending) q = q.OrderBy(x => x.CustomerTypeID);
						else q = q.OrderByDescending(x => x.CustomerTypeID);
						break;
					case Entity.CustomerDemographic.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.CustomerDemographic.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.CustomerDemographic.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.CustomerDemographic.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Customer> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Customer> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Customer> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Customer> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Customer> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Customer> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Customer> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Customer> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Customer> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Customer> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Customer, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Customer.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Customer.FieldNameConstants.Address:
						if (ob.Ascending) q = q.OrderBy(x => x.Address);
						else q = q.OrderByDescending(x => x.Address);
						break;
					case Entity.Customer.FieldNameConstants.City:
						if (ob.Ascending) q = q.OrderBy(x => x.City);
						else q = q.OrderByDescending(x => x.City);
						break;
					case Entity.Customer.FieldNameConstants.CompanyName:
						if (ob.Ascending) q = q.OrderBy(x => x.CompanyName);
						else q = q.OrderByDescending(x => x.CompanyName);
						break;
					case Entity.Customer.FieldNameConstants.ContactName:
						if (ob.Ascending) q = q.OrderBy(x => x.ContactName);
						else q = q.OrderByDescending(x => x.ContactName);
						break;
					case Entity.Customer.FieldNameConstants.ContactTitle:
						if (ob.Ascending) q = q.OrderBy(x => x.ContactTitle);
						else q = q.OrderByDescending(x => x.ContactTitle);
						break;
					case Entity.Customer.FieldNameConstants.Country:
						if (ob.Ascending) q = q.OrderBy(x => x.Country);
						else q = q.OrderByDescending(x => x.Country);
						break;
					case Entity.Customer.FieldNameConstants.CustomerID:
						if (ob.Ascending) q = q.OrderBy(x => x.CustomerID);
						else q = q.OrderByDescending(x => x.CustomerID);
						break;
					case Entity.Customer.FieldNameConstants.Fax:
						if (ob.Ascending) q = q.OrderBy(x => x.Fax);
						else q = q.OrderByDescending(x => x.Fax);
						break;
					case Entity.Customer.FieldNameConstants.Phone:
						if (ob.Ascending) q = q.OrderBy(x => x.Phone);
						else q = q.OrderByDescending(x => x.Phone);
						break;
					case Entity.Customer.FieldNameConstants.PostalCode:
						if (ob.Ascending) q = q.OrderBy(x => x.PostalCode);
						else q = q.OrderByDescending(x => x.PostalCode);
						break;
					case Entity.Customer.FieldNameConstants.Region:
						if (ob.Ascending) q = q.OrderBy(x => x.Region);
						else q = q.OrderByDescending(x => x.Region);
						break;
					case Entity.Customer.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Customer.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Customer.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Customer.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Employee> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Employee> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Employee> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Employee> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Employee> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Employee> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Employee> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Employee> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Employee> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Employee> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Employee, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Employee.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Employee.FieldNameConstants.Address:
						if (ob.Ascending) q = q.OrderBy(x => x.Address);
						else q = q.OrderByDescending(x => x.Address);
						break;
					case Entity.Employee.FieldNameConstants.BirthDate:
						if (ob.Ascending) q = q.OrderBy(x => x.BirthDate);
						else q = q.OrderByDescending(x => x.BirthDate);
						break;
					case Entity.Employee.FieldNameConstants.City:
						if (ob.Ascending) q = q.OrderBy(x => x.City);
						else q = q.OrderByDescending(x => x.City);
						break;
					case Entity.Employee.FieldNameConstants.Country:
						if (ob.Ascending) q = q.OrderBy(x => x.Country);
						else q = q.OrderByDescending(x => x.Country);
						break;
					case Entity.Employee.FieldNameConstants.EmployeeID:
						if (ob.Ascending) q = q.OrderBy(x => x.EmployeeID);
						else q = q.OrderByDescending(x => x.EmployeeID);
						break;
					case Entity.Employee.FieldNameConstants.Extension:
						if (ob.Ascending) q = q.OrderBy(x => x.Extension);
						else q = q.OrderByDescending(x => x.Extension);
						break;
					case Entity.Employee.FieldNameConstants.FirstName:
						if (ob.Ascending) q = q.OrderBy(x => x.FirstName);
						else q = q.OrderByDescending(x => x.FirstName);
						break;
					case Entity.Employee.FieldNameConstants.HireDate:
						if (ob.Ascending) q = q.OrderBy(x => x.HireDate);
						else q = q.OrderByDescending(x => x.HireDate);
						break;
					case Entity.Employee.FieldNameConstants.HomePhone:
						if (ob.Ascending) q = q.OrderBy(x => x.HomePhone);
						else q = q.OrderByDescending(x => x.HomePhone);
						break;
					case Entity.Employee.FieldNameConstants.LastName:
						if (ob.Ascending) q = q.OrderBy(x => x.LastName);
						else q = q.OrderByDescending(x => x.LastName);
						break;
					case Entity.Employee.FieldNameConstants.Notes:
						if (ob.Ascending) q = q.OrderBy(x => x.Notes);
						else q = q.OrderByDescending(x => x.Notes);
						break;
					case Entity.Employee.FieldNameConstants.Photo:
						if (ob.Ascending) q = q.OrderBy(x => x.Photo);
						else q = q.OrderByDescending(x => x.Photo);
						break;
					case Entity.Employee.FieldNameConstants.PhotoPath:
						if (ob.Ascending) q = q.OrderBy(x => x.PhotoPath);
						else q = q.OrderByDescending(x => x.PhotoPath);
						break;
					case Entity.Employee.FieldNameConstants.PostalCode:
						if (ob.Ascending) q = q.OrderBy(x => x.PostalCode);
						else q = q.OrderByDescending(x => x.PostalCode);
						break;
					case Entity.Employee.FieldNameConstants.Region:
						if (ob.Ascending) q = q.OrderBy(x => x.Region);
						else q = q.OrderByDescending(x => x.Region);
						break;
					case Entity.Employee.FieldNameConstants.ReportsTo:
						if (ob.Ascending) q = q.OrderBy(x => x.ReportsTo);
						else q = q.OrderByDescending(x => x.ReportsTo);
						break;
					case Entity.Employee.FieldNameConstants.Title:
						if (ob.Ascending) q = q.OrderBy(x => x.Title);
						else q = q.OrderByDescending(x => x.Title);
						break;
					case Entity.Employee.FieldNameConstants.TitleOfCourtesy:
						if (ob.Ascending) q = q.OrderBy(x => x.TitleOfCourtesy);
						else q = q.OrderByDescending(x => x.TitleOfCourtesy);
						break;
					case Entity.Employee.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Employee.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Employee.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Employee.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.EmployeeTerritorie.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.EmployeeTerritorie.FieldNameConstants.EmployeeID:
						if (ob.Ascending) q = q.OrderBy(x => x.EmployeeID);
						else q = q.OrderByDescending(x => x.EmployeeID);
						break;
					case Entity.EmployeeTerritorie.FieldNameConstants.TerritoryID:
						if (ob.Ascending) q = q.OrderBy(x => x.TerritoryID);
						else q = q.OrderByDescending(x => x.TerritoryID);
						break;
					case Entity.EmployeeTerritorie.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.EmployeeTerritorie.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.EmployeeTerritorie.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.EmployeeTerritorie.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.OrderDetail> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.OrderDetail> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.OrderDetail> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.OrderDetail> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.OrderDetail> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.OrderDetail> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.OrderDetail> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.OrderDetail> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.OrderDetail> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.OrderDetail> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.OrderDetail, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.OrderDetail.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.OrderDetail.FieldNameConstants.Discount:
						if (ob.Ascending) q = q.OrderBy(x => x.Discount);
						else q = q.OrderByDescending(x => x.Discount);
						break;
					case Entity.OrderDetail.FieldNameConstants.OrderID:
						if (ob.Ascending) q = q.OrderBy(x => x.OrderID);
						else q = q.OrderByDescending(x => x.OrderID);
						break;
					case Entity.OrderDetail.FieldNameConstants.ProductID:
						if (ob.Ascending) q = q.OrderBy(x => x.ProductID);
						else q = q.OrderByDescending(x => x.ProductID);
						break;
					case Entity.OrderDetail.FieldNameConstants.Quantity:
						if (ob.Ascending) q = q.OrderBy(x => x.Quantity);
						else q = q.OrderByDescending(x => x.Quantity);
						break;
					case Entity.OrderDetail.FieldNameConstants.UnitPrice:
						if (ob.Ascending) q = q.OrderBy(x => x.UnitPrice);
						else q = q.OrderByDescending(x => x.UnitPrice);
						break;
					case Entity.OrderDetail.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.OrderDetail.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.OrderDetail.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.OrderDetail.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Order> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Order> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Order> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Order> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Order> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Order> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Order> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Order> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Order> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Order> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Order, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Order.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Order.FieldNameConstants.CustomerID:
						if (ob.Ascending) q = q.OrderBy(x => x.CustomerID);
						else q = q.OrderByDescending(x => x.CustomerID);
						break;
					case Entity.Order.FieldNameConstants.EmployeeID:
						if (ob.Ascending) q = q.OrderBy(x => x.EmployeeID);
						else q = q.OrderByDescending(x => x.EmployeeID);
						break;
					case Entity.Order.FieldNameConstants.Freight:
						if (ob.Ascending) q = q.OrderBy(x => x.Freight);
						else q = q.OrderByDescending(x => x.Freight);
						break;
					case Entity.Order.FieldNameConstants.OrderDate:
						if (ob.Ascending) q = q.OrderBy(x => x.OrderDate);
						else q = q.OrderByDescending(x => x.OrderDate);
						break;
					case Entity.Order.FieldNameConstants.OrderID:
						if (ob.Ascending) q = q.OrderBy(x => x.OrderID);
						else q = q.OrderByDescending(x => x.OrderID);
						break;
					case Entity.Order.FieldNameConstants.RequiredDate:
						if (ob.Ascending) q = q.OrderBy(x => x.RequiredDate);
						else q = q.OrderByDescending(x => x.RequiredDate);
						break;
					case Entity.Order.FieldNameConstants.ShipAddress:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipAddress);
						else q = q.OrderByDescending(x => x.ShipAddress);
						break;
					case Entity.Order.FieldNameConstants.ShipCity:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipCity);
						else q = q.OrderByDescending(x => x.ShipCity);
						break;
					case Entity.Order.FieldNameConstants.ShipCountry:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipCountry);
						else q = q.OrderByDescending(x => x.ShipCountry);
						break;
					case Entity.Order.FieldNameConstants.ShipName:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipName);
						else q = q.OrderByDescending(x => x.ShipName);
						break;
					case Entity.Order.FieldNameConstants.ShippedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ShippedDate);
						else q = q.OrderByDescending(x => x.ShippedDate);
						break;
					case Entity.Order.FieldNameConstants.ShipPostalCode:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipPostalCode);
						else q = q.OrderByDescending(x => x.ShipPostalCode);
						break;
					case Entity.Order.FieldNameConstants.ShipRegion:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipRegion);
						else q = q.OrderByDescending(x => x.ShipRegion);
						break;
					case Entity.Order.FieldNameConstants.ShipVia:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipVia);
						else q = q.OrderByDescending(x => x.ShipVia);
						break;
					case Entity.Order.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Order.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Order.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Order.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Product> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Product> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Product> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Product> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Product> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Product> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Product> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Product> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Product> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Product> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Product, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Product.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Product.FieldNameConstants.CategoryID:
						if (ob.Ascending) q = q.OrderBy(x => x.CategoryID);
						else q = q.OrderByDescending(x => x.CategoryID);
						break;
					case Entity.Product.FieldNameConstants.Discontinued:
						if (ob.Ascending) q = q.OrderBy(x => x.Discontinued);
						else q = q.OrderByDescending(x => x.Discontinued);
						break;
					case Entity.Product.FieldNameConstants.ProductID:
						if (ob.Ascending) q = q.OrderBy(x => x.ProductID);
						else q = q.OrderByDescending(x => x.ProductID);
						break;
					case Entity.Product.FieldNameConstants.ProductName:
						if (ob.Ascending) q = q.OrderBy(x => x.ProductName);
						else q = q.OrderByDescending(x => x.ProductName);
						break;
					case Entity.Product.FieldNameConstants.QuantityPerUnit:
						if (ob.Ascending) q = q.OrderBy(x => x.QuantityPerUnit);
						else q = q.OrderByDescending(x => x.QuantityPerUnit);
						break;
					case Entity.Product.FieldNameConstants.ReorderLevel:
						if (ob.Ascending) q = q.OrderBy(x => x.ReorderLevel);
						else q = q.OrderByDescending(x => x.ReorderLevel);
						break;
					case Entity.Product.FieldNameConstants.SupplierID:
						if (ob.Ascending) q = q.OrderBy(x => x.SupplierID);
						else q = q.OrderByDescending(x => x.SupplierID);
						break;
					case Entity.Product.FieldNameConstants.UnitPrice:
						if (ob.Ascending) q = q.OrderBy(x => x.UnitPrice);
						else q = q.OrderByDescending(x => x.UnitPrice);
						break;
					case Entity.Product.FieldNameConstants.UnitsInStock:
						if (ob.Ascending) q = q.OrderBy(x => x.UnitsInStock);
						else q = q.OrderByDescending(x => x.UnitsInStock);
						break;
					case Entity.Product.FieldNameConstants.UnitsOnOrder:
						if (ob.Ascending) q = q.OrderBy(x => x.UnitsOnOrder);
						else q = q.OrderByDescending(x => x.UnitsOnOrder);
						break;
					case Entity.Product.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Product.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Product.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Product.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Region> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Region> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Region> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Region> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Region> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Region> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Region> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Region> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Region> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Region> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Region, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Region.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Region.FieldNameConstants.RegionDescription:
						if (ob.Ascending) q = q.OrderBy(x => x.RegionDescription);
						else q = q.OrderByDescending(x => x.RegionDescription);
						break;
					case Entity.Region.FieldNameConstants.RegionID:
						if (ob.Ascending) q = q.OrderBy(x => x.RegionID);
						else q = q.OrderByDescending(x => x.RegionID);
						break;
					case Entity.Region.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Region.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Region.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Region.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Shipper> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Shipper> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Shipper> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Shipper> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Shipper> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Shipper> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Shipper> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Shipper> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Shipper> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Shipper> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Shipper, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Shipper.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Shipper.FieldNameConstants.CompanyName:
						if (ob.Ascending) q = q.OrderBy(x => x.CompanyName);
						else q = q.OrderByDescending(x => x.CompanyName);
						break;
					case Entity.Shipper.FieldNameConstants.Phone:
						if (ob.Ascending) q = q.OrderBy(x => x.Phone);
						else q = q.OrderByDescending(x => x.Phone);
						break;
					case Entity.Shipper.FieldNameConstants.ShipperID:
						if (ob.Ascending) q = q.OrderBy(x => x.ShipperID);
						else q = q.OrderByDescending(x => x.ShipperID);
						break;
					case Entity.Shipper.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Shipper.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Shipper.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Shipper.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Supplier> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Supplier> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Supplier> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Supplier> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Supplier> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Supplier> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Supplier> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Supplier> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Supplier> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Supplier> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Supplier, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Supplier.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Supplier.FieldNameConstants.Address:
						if (ob.Ascending) q = q.OrderBy(x => x.Address);
						else q = q.OrderByDescending(x => x.Address);
						break;
					case Entity.Supplier.FieldNameConstants.City:
						if (ob.Ascending) q = q.OrderBy(x => x.City);
						else q = q.OrderByDescending(x => x.City);
						break;
					case Entity.Supplier.FieldNameConstants.CompanyName:
						if (ob.Ascending) q = q.OrderBy(x => x.CompanyName);
						else q = q.OrderByDescending(x => x.CompanyName);
						break;
					case Entity.Supplier.FieldNameConstants.ContactName:
						if (ob.Ascending) q = q.OrderBy(x => x.ContactName);
						else q = q.OrderByDescending(x => x.ContactName);
						break;
					case Entity.Supplier.FieldNameConstants.ContactTitle:
						if (ob.Ascending) q = q.OrderBy(x => x.ContactTitle);
						else q = q.OrderByDescending(x => x.ContactTitle);
						break;
					case Entity.Supplier.FieldNameConstants.Country:
						if (ob.Ascending) q = q.OrderBy(x => x.Country);
						else q = q.OrderByDescending(x => x.Country);
						break;
					case Entity.Supplier.FieldNameConstants.Fax:
						if (ob.Ascending) q = q.OrderBy(x => x.Fax);
						else q = q.OrderByDescending(x => x.Fax);
						break;
					case Entity.Supplier.FieldNameConstants.HomePage:
						if (ob.Ascending) q = q.OrderBy(x => x.HomePage);
						else q = q.OrderByDescending(x => x.HomePage);
						break;
					case Entity.Supplier.FieldNameConstants.Phone:
						if (ob.Ascending) q = q.OrderBy(x => x.Phone);
						else q = q.OrderByDescending(x => x.Phone);
						break;
					case Entity.Supplier.FieldNameConstants.PostalCode:
						if (ob.Ascending) q = q.OrderBy(x => x.PostalCode);
						else q = q.OrderByDescending(x => x.PostalCode);
						break;
					case Entity.Supplier.FieldNameConstants.Region:
						if (ob.Ascending) q = q.OrderBy(x => x.Region);
						else q = q.OrderByDescending(x => x.Region);
						break;
					case Entity.Supplier.FieldNameConstants.SupplierID:
						if (ob.Ascending) q = q.OrderBy(x => x.SupplierID);
						else q = q.OrderByDescending(x => x.SupplierID);
						break;
					case Entity.Supplier.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Supplier.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Supplier.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Supplier.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Territory> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Territory> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Territory> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Territory> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, TKey>> orderBy,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(where, orderBy, true, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Territory> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Territory> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			return item.GetPagedResults(x => true, orderBy, orderAscending, paging);
		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderBy">The sort order of this data set</param>
		/// <param name="orderAscending">The direction of sort</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Territory> GetPagedResults<TKey>(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Territory> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, bool>> where,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, TKey>> orderBy,
			bool orderAscending,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			if (orderAscending)
				q = q.OrderBy(orderBy);
			else
				q = q.OrderByDescending(orderBy);

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		/// <summary>
		/// Pulls a paged set of data based on the paging criteria
		/// </summary>
		/// <param name="item">The ObjectSet from which to pull data</param>
		/// <param name="where">The filter by which to pull data</param>
		/// <param name="orderByList">The sort order of this data set</param>
		/// <param name="paging">The paging object that controls how data is selected. It will contain additional paging information on output.</param>
		public static IEnumerable<Acme.Northwind.EFDAL.Entity.Territory> GetPagedResults(
			this System.Data.Objects.ObjectSet<Acme.Northwind.EFDAL.Entity.Territory> item,
			System.Linq.Expressions.Expression<Func<Acme.Northwind.EFDAL.Entity.Territory, bool>> where,
			IEnumerable<nHydrate.EFCore.DataAccess.OrderedWrapper<Acme.Northwind.EFDAL.Entity.Territory.FieldNameConstants>> orderByList,
			nHydrate.EFCore.DataAccess.Paging paging)
		{
			var index = paging.PageIndex;
			var rpp = paging.RecordsperPage;
			if (index < 1) index = 1;
			if (rpp < 1) rpp = 1;

			paging.RecordCount = item.Count(where);
			paging.PageCount = paging.RecordCount / rpp;
			if ((paging.RecordCount % rpp) != 0) paging.PageCount++;

			var q = item.Where(where);

			foreach (var ob in orderByList)
			{
				switch (ob.Field)
				{
					case Entity.Territory.FieldNameConstants.RegionID:
						if (ob.Ascending) q = q.OrderBy(x => x.RegionID);
						else q = q.OrderByDescending(x => x.RegionID);
						break;
					case Entity.Territory.FieldNameConstants.TerritoryDescription:
						if (ob.Ascending) q = q.OrderBy(x => x.TerritoryDescription);
						else q = q.OrderByDescending(x => x.TerritoryDescription);
						break;
					case Entity.Territory.FieldNameConstants.TerritoryID:
						if (ob.Ascending) q = q.OrderBy(x => x.TerritoryID);
						else q = q.OrderByDescending(x => x.TerritoryID);
						break;
					case Entity.Territory.FieldNameConstants.CreatedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedDate);
						else q = q.OrderByDescending(x => x.CreatedDate);
						break;
					case Entity.Territory.FieldNameConstants.CreatedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.CreatedBy);
						else q = q.OrderByDescending(x => x.CreatedBy);
						break;
					case Entity.Territory.FieldNameConstants.ModifiedDate:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedDate);
						else q = q.OrderByDescending(x => x.ModifiedDate);
						break;
					case Entity.Territory.FieldNameConstants.ModifiedBy:
						if (ob.Ascending) q = q.OrderBy(x => x.ModifiedBy);
						else q = q.OrderByDescending(x => x.ModifiedBy);
						break;
				}
			}

			return q.Skip((index - 1) * rpp)
							.Take(rpp)
							.ToList();

		}

		#endregion

		#region ObservableCollection
		/// <summary>
		/// Returns an observable collection that can bound to UI controls
		/// </summary>
		public static System.Collections.ObjectModel.ObservableCollection<T> AsObservable<T>(this System.Collections.Generic.IEnumerable<T> list)
			where T : nHydrate.EFCore.DataAccess.NHEntityObject
		{
			var retval = new System.Collections.ObjectModel.ObservableCollection<T>();
			foreach (var o in list)
				retval.Add(o);
			return retval;
		}
		#endregion

		#region Purge
		/// <summary>
		/// Marks all objects in the list for deletion
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="list">The list of objects to remove</param>
		/// <param name="context">The context in which the calling object exists
		/// </param>
		public static void Purge<T>(this System.Data.Objects.DataClasses.EntityCollection<T> list, Acme.Northwind.EFDAL.NorthwindEntities context)
			where T : nHydrate.EFCore.DataAccess.NHEntityObject
		{
			list.ToList().ForEach(x => context.DeleteItem((nHydrate.EFCore.DataAccess.IBusinessObject)x));
		}
		#endregion

	}

	#endregion

}
